package panel;

import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;

public class Log {

    private volatile static PrintWriter out;

    public final static void open(){
        if (null != out)
            Log.close();
        try {
            out = new PrintWriter(new FileWriter("log.txt"));
        }
        catch (IOException exc){
            exc.printStackTrace();
        }
    }
    public final static void close(){
        PrintWriter out = Log.out;
        Log.out = null;
        if (null != out)
            out.close();
    }
    public final static void println(String fmt, Object...args){
        PrintWriter out = Log.out;
        if (null != out)
            out.println(String.format(fmt,args));
    }

    
}
